{template 'common/header'}

<ul class="nav nav-tabs">
	<li><a href="{php echo $this->createWebUrl('item',array('op' =>'display'))}">商品管理</a></li>
	<li{if $operation == 'create'} class="active" {/if}><a href="{php echo $this->createWebUrl('item',array('op' =>'create'))}">添加商品</a></li>
</ul>

<form action="{php echo $this->createWebUrl('item', array('op' => 'create'))}" method="post" class="form-horizontal form" enctype="multipart/form-data">
	<div class="panel panel-default we7-panel">
		<div class="panel-heading">添加商品</div>
		<div class="panel-body we7-padding">
		    <div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">排列顺序</label>
				<div class="col-sm-9">
					<input type="text" name="data[sort]"  value="0" class="form-control" placeholder="请填写排列顺序" />
					<span class="help-block" style="color:#f00">降序</span>
				</div>
			</div>
		    <div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">商品类型：</label>
				<div class="col-sm-9 col-xs-12">
					<label class="radio-inline"><input type="radio" name="data[is_matter]" value="0" checked="true" /> 虚拟商品（无需物流）</label>
					&nbsp;&nbsp;&nbsp;
					<label class="radio-inline"><input type="radio" name="data[is_matter]" value="1" /> 实物商品（需要物流）</label>
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">商品分类</label>
				<div class="col-sm-6 col-xs-12">
					<select name="data[cateid]" class="form-control">
						<option value="">请选择分类</option>
						{loop $mercat $row}
							<option value="{$row['id']}">{$row['catename']}</option>
						{/loop}
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">商品标题</label>
				<div class="col-sm-9">
					<input type="text" name="data[title]" class="form-control" placeholder="请填写商品标题" />
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">商品图片</label>
				<div class="col-sm-9">
					{php echo tpl_form_field_multi_image('photos', [] , array());}
					<span class="help-block" style="color:#f00">请上传商品图片，支持多张图片，建议尺寸750 X 600像素</span>
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">商品描述</label>
				<div class="col-sm-9">
					<input type="text" name="data[desc]" class="form-control" placeholder="请填写商品简要描述" />
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">商品所需积分</label>
				<div class="col-sm-9">
					<input type="text" name="data[price]" class="form-control" placeholder="请填写商品所需积分" />
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">商品价格</label>
				<div class="col-sm-9">
					<input type="text" name="data[market_price]" class="form-control" placeholder="请填写商品价格" />
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">库存数量</label>
				<div class="col-sm-9">
					<input type="text" name="data[stock]" class="form-control" placeholder="请填写库存数量" />
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">已兑换数量</label>
				<div class="col-sm-9">
					<input type="text" name="data[sold]"  value="{$detail['sold']}" class="form-control" placeholder="请填写已兑换数量" />
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">停用（请使用下面的商品详情）</label>
				<div class="col-sm-9">
					{php echo tpl_form_field_multi_image('details', [], array());}
					<span class="help-block" style="color:#f00">请上传商品详情图片，支持多张图片</span>
				</div>
			</div>
			<div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">商品详情</label>
                <div class="col-sm-9">
                    {php echo tpl_ueditor('data[details2]','',['height' => 500]);}
                </div>
            </div>
			<div class="form-group">
				<div class="col-md-6 col-sm-offset-3 col-md-offset-2">
					<input name="submit" type="submit" value="提交保存" class="btn btn-primary" />
					<input type="hidden" name="token" value="{$_W['token']}" />
				</div>
			</div>
		</div>
	</div>
</form>
{template 'common/footer'}